services:
  nest-app-api:
    build:
      context: ./articles-app
    container_name: nestjs
    env_file:
      - ./articles-app/.env
    ports:
      - '3000:3000'
    volumes:
      - ./articles-app:/home/node/app
      - ./__docker/__uploads:/home/node/app/uploads
    depends_on:
      - nest-app-apidb

  nest-app-apidb:
    image: postgres:16.2
    restart: unless-stopped
    container_name: postgres
    env_file:
      - ./articles-app/.env
    ports:
      - '5432:5432'
    volumes:
      - ./__docker/__apidb:/var/lib/postgresql/data
      - ./__sql:/tmp/backups

  nest-app-pgadmin:
    image: dpage/pgadmin4
    restart: unless-stopped
    container_name: pgadmin4
    env_file:
      - ./articles-app/.env
    ports:
      - '5050:80'
    volumes:
      - ./__docker/__pgadmin:/tmp/pgadmin_session
    depends_on:
      - nest-app-apidb

  nest-app-site:
    container_name: site
    build: 
      context:
        ./articles-front
    ports:
      - 4200:4200
    volumes:
      - ./articles-front:/home/node/app
      # - /home/node/app/node_modules
    depends_on:
      - nest-app-api
